<!DOCTYPE HTML>
<html lang="en">
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'found.label', default: 'Describe what you found')}" />
		<title>${entityName}</title>
	</head>

	<body>
    	<script src="${resource(dir: 'js', file: 'jquery-ui-timepicker-addon.js')}" type="text/javascript"></script>
    	
		<div id="width960">
			<div id="notag-box" class="formBox">
				<g:if test="${flash.message}">
					<div class="message" role="status">${flash.message}</div>
				</g:if>
				<g:hasErrors bean="${cmd}">
					<ul class="errors" role="alert">
						<g:eachError bean="${cmd}" var="error">
						<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
						</g:eachError>
					</ul>
				</g:hasErrors>
			
				<div class="row">
					<div class="col c1">&nbsp;</div>
					<div class="col c10">		
						<g:form action="step">
							<g:hiddenField name="wizardStep" value="${cmd.wizardStep }"/>
							<g:hiddenField name="appUser.id" value="${cmd.user?.id }"/>
							<g:hiddenField name="serialNumber" value="${cmd.serialNumber}"/>
							<g:hiddenField name="itemId" value="${cmd.itemId}"/>
							<g:hiddenField name="eventId" value="${cmd.eventId}"/>
							<g:hiddenField name="contact.id" value="${cmd.contact?.id}"/>

							<fieldset class="embedded">
								<div class="wizardStepDisplay">
									<div class="found_sprite ${cmd.wizardStep}"></div>
								</div>
								<g:if test="${ cmd.wizardStep == 'identify' }">
									<div class="instructions">
										<p><g:message code="found.identify.instructions" default="There is an 8 digit number on the label.  Please enter it here." /></p>
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'serialNumber', 'error')} required">
										<label for="serialNumber"><g:message code="found.label.tagId" default="Tag ID:" /></label>
										<span class="required-indicator">*</span>
										<input type="text" hint="Label Serial #" id="serialNumber" name="serialNumber" class="formTextInput" value="${cmd.serialNumber }"><br/>
									</div>
								</g:if>
								<g:if test="${ cmd.wizardStep == 'confirm' }">
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'description', 'error')} required">
										<label for="description"><g:message code="found.label.description" default="Description" /></label>
										<span class="required-indicator">*</span>
										<g:textArea hint="Describe the item" id="description" name="description" class="formTextInput" value="${cmd.description}"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'found', 'error')} required">
										<label for="foundDateTime"><g:message code="found.label.time" default="On:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Found Time" id="foundDateTime" name="found" class="formTextInput time" value="${cmd.found}"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'location', 'error')} required">
										<label for="location"><g:message code="found.label.location" default="In:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Location City" id="location" name="location" class="formTextInput" value="${cmd.location}"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'venue', 'error')} required">
										<label for="venue"><g:message code="found.label.venue" default="At:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Venue (Airport Name, Car rental Agency, etc)" id="venue" name="venue" class="formTextInput" value="${cmd.venue}"/><br />
									</div>
								</g:if>
								<g:if test="${cmd.wizardStep == 'contact'}">
									<div class="instructions">
										<p><g:message code="found.contact.instructions" default="Please enter the info that we need to cantact you and arrange the return (and reward)." /></p>
									</div>
								
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactname', 'error')} required">
										<label for="contactname"><g:message code="found.label.contact.name" default="Name:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Enter Name" id="contactname" name="contact.name" class="formTextInput" value="${cmd.contact?.name }"/>
									</div>
									
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactdirect', 'error')}">
										<label for="contactdirect"><g:message code="found.label.contact.direct" default="Can Contact Directly:" /></label>
										<g:checkBox name="contactdirect" value="${cmd.contactdirect }"/>
										<div class="instructions">
											<p><g:message code="found.label.contact.direct.instructions" default="Can Contact Directly:" /></p>
										</div>
									</div>
									
									<fieldset class="nested">
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactphone', 'error')} required">
											<label for="contactphone"><g:message code="found.label.contact.phone" default="Phone:" /></label>
											<span class="required-indicator">*</span>
											<g:textField hint="Enter Phone" name="phone" name="phone" class="formTextInput" value="${cmd.phone}"/><br/>
										</div>
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'useSms', 'error')}">
											<label for="useSms"><g:message code="found.label.contact.sms" default="SMS:" /></label>
											<g:checkBox name="useSms" value="${cmd.useSms}"/>
											<div class="instructions">
												<p><g:message code="found.label.contact.sms.instructions" default="SMS:" /></p>
											</div>
										</div>
									</fieldset>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactemail', 'error')} required">
										<label for="contactemail"><g:message code="found.label.contact.email" default="E-Mail:" /></label>
										<span class="required-indicator">*</span>
										<input type="text" hint="Enter e-mail" id="contactemail" name="contact.email" class="formTextInput" value="${cmd.contact?.email}"/>
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactskype', 'error')}">
										<label for="contactSkype"><g:message code="found.label.contact.skype" default="Skype:" /></label>
										<input type="text" hint="Enter skype ID" id="contactskype" name="contact.skypeId" class="formTextInput" value="${cmd.contact?.skypeId}"/>
									</div>
										<fieldset class="nested">
											<legend>Mailing Location for Return Container</legend>
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.address1', 'error')}">
												<label for="mailing.address1">
													<g:message code="appUser.mailing.address1.label" default="Address1" />
													<span class="required-indicator">*</span>
												</label>
												<g:textField name="mailing.address1" required="" value="${cmd.mailing?.address1}"/>
											</div>
											
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.address2', 'error')} ">
												<label for="mailing.address2">
													<g:message code="appUser.mailing.address2.label" default="Address2" />
													
												</label>
												<g:textField name="mailing.address2" value="${cmd.mailing?.address2}"/>
											</div>
											
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.country', 'error')} required">
												<label for="mailing.country">
													<g:message code="appUser.mailing.country.label" default="Country" />
													<span class="required-indicator">*</span>
												</label>
												<g:select name="mailing.country" from="${['US', 'CA']}"
			         								 valueMessagePrefix="mailing.country" />
											</div>
											
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.zipCode', 'error')} required">
												<span class="required-indicator"style="margin-left:25px;">Begin typing a Zip code and select your City and State:</span><br/>
												<label for="mailing.zipCode">
													<g:message code="appUser.mailing.zipCode.label" default="Zip Code" />
													<span class="required-indicator">*</span>
												</label>
												<g:textField name="mailing.zipCode" pattern="${cmd.mailing.constraints.zipCode.matches}" required="" value="${cmd.mailing?.zipCode}"/>
											</div>
											
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.city', 'error')} required">
												<label for="mailing.city">
													<g:message code="appUser.mailing.city.label" default="City" />
													<span class="required-indicator">*</span>
												</label>
												<g:textField name="mailing.city" required="" value="${cmd.mailing?.city}"/>
											</div>
											
											<div class="fieldcontain ${hasErrors(bean: cmd, field: 'mailing.state', 'error')} required">
												<label for="mailing.state">
													<g:message code="appUser.mailing.state.label" default="State" />
													<span class="required-indicator">*</span>
												</label>
												<g:textField name="mailing.state" required="" value="${cmd.mailing?.state}"/>
											</div>
										</fieldset>									
								</g:if>
								<g:if test="${ cmd.wizardStep == 'review' }">
									<div class="instructions"><p>Please review the information entered, and when satisfied, click finish to notify the owner that their item is safe.</p></div>
									<fieldset class="nested">
										<legend>Item</legend>
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'description', 'error')} required">
										<label for="description"><g:message code="found.label.description" default="Description" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Describe the item" id="description" name="description" class="formTextInput" value="${cmd.description}" disabled="true"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'found', 'error')} required">
										<label for="foundDateTime"><g:message code="found.label.time" default="On:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Found Time" id="foundDateTime" name="found" class="formTextInput time" value="${cmd.found}" disabled="true"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'location', 'error')} required">
										<label for="location"><g:message code="found.label.location" default="In:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Location City" id="location" name="location" class="formTextInput" value="${cmd.location}" disabled="true"/><br />
									</div>
									<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'venue', 'error')} required">
										<label for="venue"><g:message code="found.label.venue" default="At:" /></label>
										<span class="required-indicator">*</span>
										<g:textField hint="Venue (Airport Name, Car rental Agency, etc)" id="venue" name="venue" class="formTextInput" value="${cmd.venue}" disabled="true"/><br />
									</div>
									</fieldset>
									<fieldset class="nested">
										<legend>Contact</legend>
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactname', 'error')} required">
											<label for="contactname"><g:message code="found.label.contact.name" default="Name:" /></label>
											<span class="required-indicator">*</span>
											<g:textField hint="Enter Name" name="contact.name" class="formTextInput" value="${cmd.contact.name }" disabled="true"/>
										</div>
										<fieldset class="nested">
											<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactphone', 'error')} required">
												<label for="contactphone"><g:message code="found.label.contact.phone" default="Phone:" /></label>
												<span class="required-indicator">*</span>
												<g:textField hint="Enter Phone" id="contactphone" name="phone" class="formTextInput" value="${cmd.phone}" disabled="true"/><br/>
											</div>
											<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'useSms', 'error')}">
												<label for="useSms"><g:message code="found.label.contact.sms" default="SMS:" /></label>
												<g:checkBox name="useSms" value="${cmd.useSms}"/><br/>
											</div>
										</fieldset>
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactemail', 'error')}">
											<label for="contactemail"><g:message code="found.label.contact.email" default="E-Mail:" /></label>
											<input type="text" hint="Enter e-mail" id="contactemail" name="contact.email" class="formTextInput" value="${cmd.contact.email}" disabled="true"/>
										</div>
										<div id="tag-box" class="fieldcontain ${hasErrors(bean: cmd, field: 'contactskype', 'error')}">
											<label for="contactSkype"><g:message code="found.label.contact.skype" default="Skype:" /></label>
											<input type="text" hint="Enter skype ID" id="contactskype" name="contact.skypeId" class="formTextInput" value="${cmd.contact.skypeId}" disabled="true"/>
										</div>
										<fieldset class="embedded">
											<legend>Mailing Location for Return Container</legend>
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailingAddress.address1', 'error')} required">
													<label for="mailing.address1">
														<g:message code="appUser.mailing.address1.label" default="Address1" />
														<span class="required-indicator">*</span>
													</label>
													<g:textField name="mailing.address1" required="" value="${cmd.contact?.mailingAddress?.address1}" disabled="true"/>
												</div>
												
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailingAddress.address2', 'error')} ">
													<label for="mailing.address2">
														<g:message code="appUser.mailing.address2.label" default="Address2" />
														
													</label>
													<g:textField name="mailing.address2" value="${cmd.contact?.mailingAddress?.address2}" disabled="true"/>
												</div>
												
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailingAddress.country', 'error')} required">
													<label for="mailing.country">
														<g:message code="appUser.mailing.country.label" default="Country" />
														<span class="required-indicator">*</span>
													</label>
													<g:select name="contact.mailingAddress.country" from="${['US', 'CA']}" disabled="true"
				         								 valueMessagePrefix="contact.mailingAddress.country" />
												</div>
												
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailingAddress.zipCode', 'error')} required">
													<label for="mailing.zipCode">
														<g:message code="appUser.mailing.zipCode.label" default="Zip Code" />
														<span class="required-indicator">*</span>
													</label>
													<g:textField name="mailing.zipCode" pattern="${cmd.mailing.constraints.zipCode.matches}" required="" value="${cmd.contact?.mailingAddress?.zipCode}" disabled="true"/>
												</div>
												
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailing.city', 'error')} required">
													<label for="mailing.city">
														<g:message code="appUser.mailing.city.label" default="City" />
														<span class="required-indicator">*</span>
													</label>
													<g:textField name="mailing.city" required="" value="${cmd.contact?.mailingAddress?.city}" disabled="true"/>
												</div>
												
												<div class="fieldcontain ${hasErrors(bean: cmd, field: 'contact.mailing.state', 'error')} required">
													<label for="mailing.state">
														<g:message code="appUser.mailingAddress.state.label" default="State" />
														<span class="required-indicator">*</span>
													</label>
													<g:textField name="mailing.state" required="" value="${cmd.contact?.mailingAddress?.state}" disabled="true"/>
												</div>
										</fieldset>									
									</fieldset>
								</g:if>
								<div class="buttons">
									<g:if test="${ cmd.wizardStep != 'identify' }">
										<g:submitButton class="basic-ok-button submitButton" name="previous" value="Previous" action="previous"/>
									</g:if>
									<g:submitButton name="Next" value="${ cmd.wizardStep == 'review' ? 'Finish' : 'Next' }"/>
								</div>
							</fieldset>
									
						</g:form>
					</div>
				</div>
			</div>		
		</div>
	</body>
<script type="text/javascript">
<!--
$(document).ready(function(){
	//$('#tag-box, #notag-box').hide();
	
	$('input[name="tagExists"]').click(function(){
		   $('#tag-box, #notag-box').hide();
		   if ($(this).attr('value') === 'true') {
			   $('#tag-box').show();
		   }
		   else {
			   $('#notag-box').show();
		   }
	   });
});
-->
</script>
</html>
